package com.demo.demo.service;

import com.demo.demo.dao.UserInfoDao;
import com.demo.demo.domain.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserInfoService {
    @Autowired
    private UserInfoDao userInfoDao;

    public UserInfo findById(long Id) {
        return userInfoDao.getOne(Id);
    }

    public UserInfo findByCode(String code) {
        return userInfoDao.findByCode(code);
    }

    public UserInfo findByCodeAndAccount(String code, String account) {
        return userInfoDao.findByCodeAndAccount(code, account);
    }

    public List<UserInfo> findAll() {
        return userInfoDao.findAll();
    }

    public void save(UserInfo userInfo) {
        userInfoDao.save(userInfo);
    }

    public void delete(long Id) {
        userInfoDao.deleteById(Id);
    }
}
